import * as API from '../axios'

export default {



  //网点下拉框
  getShopId: params => {
    return API.axiosGetAPI('/manage/branches/box', params)
  },

  //用户组下拉框
  getUserId: params => {
    return API.axiosGetAPI('/manage/users/user-group/box', params)
  },

  //获取优惠码金额统计
  getCodeTotal: () => {
    return API.axiosGetAPI('/manage/promo-codes/statistics/awarded')
  },

  //优惠码列表
  getPromoCodes: (pageNum, pageSize, params) => {
    return API.axiosGetAPI(`/manage/promo-codes/${pageNum}/${pageSize}`, params)
  },

  //新增优惠码
  addCodes: params => {
    const headers = {'lang-key': 'branch_Create'}
    return API.axiosPostAPI('/manage/promo-codes', params,headers)
  },

  //编辑优惠码
  editCodes: params => {
    const headers = {'lang-key': 'Users_Edit'}
    return API.axiosPutAPI('/manage/promo-codes', params, headers)
  },

  //获取优惠码编辑信息
  getCodeDetail: params => {
    return API.axiosGetAPI(`/manage/promo-codes/${params}`)
  },

  //获取优惠码详情
  getCodeDetails: params => {
    return API.axiosGetAPI(`/manage/promo-codes/detail/${params}`)
  },

  //获取优惠码兑换记录
  getCodeHistory: (id, pageNum, pageSize) => {
    return API.axiosGetAPI(
      `/manage/promo-codes/${id}/usage/${pageNum}/${pageSize}`
    )
  },



  //合作伙伴下拉框
  getPartnerId: params => {
    return API.axiosGetAPI('/manage/promo-code-partners/box', params)
  },

  //新增合作伙伴
  addPartner: params => {
    const headers = {'lang-key': 'branch_Create'}
    return API.axiosPostAPI('/manage/promo-code-partners', params,headers)
  },

  //邀请奖励列表
  getPageInvitation: (pageNum, pageSize, params) => {
    return API.axiosGetAPI(
      `/manage/invitation-rewards/${pageNum}/${pageSize}`,
      params
    )
  },

  //新增奖励
  addInvitation: params => {
    const headers = {'lang-key': 'branch_Create'}
    return API.axiosPostAPI('/manage/invitation-rewards', params,headers)
  },

  //编辑奖励
  editInvitation: params => {
    const headers = {'lang-key': 'Users_Edit'}
    return API.axiosPutAPI('/manage/invitation-rewards', params, headers)
  },

  //获取奖励详情
  getInvitationDetail: params => {
    return API.axiosGetAPI(`/manage/invitation-rewards/${params}`)
  },

  //获取积分礼物列表
  getPoints: (pageNum, pageSize, params) => {
    return API.axiosGetAPI(`/manage/point-gifts/${pageNum}/${pageSize}`, params)
  },

  //新增积分礼物
  addPointGifts: params => {
    const headers = {'lang-key': 'branch_Create'}
    return API.axiosPostAPI('/manage/point-gifts', params,headers)
  },

  //编辑积分礼物
  editPointGifts: params => {
    const headers = {'lang-key': 'Users_Edit'}
    return API.axiosPutAPI('/manage/point-gifts', params, headers)
  },

  //获取积分礼物详情
  getPointGiftsDetail: params => {
    return API.axiosGetAPI(`/manage/point-gifts/${params}`)
  },

  //审核积分礼物兑换
  reviewGifts: params => {
    return API.axiosPutAPI('/manage/point-gifts/redeem/audit', params)
  },

  //获取积分统计数
  getPointsTotal: () => {
    return API.axiosGetAPI('/manage/point/statistics')
  },

  //获取积分记录列表
  getPointRecords: (pageNum, pageSize, params) => {
    return API.axiosGetAPI(
      `/manage/point-records/${pageNum}/${pageSize}`,
      params
    )
  },

  //获取积分礼物兑换记录列表
  getRedeems: (pageNum, pageSize, params) => {
    return API.axiosGetAPI(
      `/manage/point-gifts/redeem/${pageNum}/${pageSize}`,
      params
    )
  },

  //获取合作伙伴列表
  getPartners: (pageNum, pageSize, params) => {
    return API.axiosGetAPI(
      `/manage/promo-code-partners/${pageNum}/${pageSize}`,
      params
    )
  },

  //编辑合作伙伴
  editPartners: params => {
    const headers = {'lang-key': 'Users_Edit'}
    return API.axiosPutAPI('/manage/promo-code-partners', params, headers)
  },


}
